package com.example.backend.controller;

import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.backend.common.Result;
import com.example.backend.entity.Program;
import com.example.backend.entity.VoteRecord;
import com.example.backend.mapper.VoteRecordMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("/vote_record")
public class VoteRecordController {
    @Resource
    VoteRecordMapper voteRecordMapper;

    @GetMapping("gets")
    public Result<?> gets() throws IOException {
        LambdaQueryWrapper<VoteRecord> wrapper = Wrappers.<VoteRecord>lambdaQuery().orderByAsc(VoteRecord::getUserId);
//        wrapper.eq(VoteRecord::getParentId,entity.getId());
        List<VoteRecord> res = voteRecordMapper.selectList(wrapper);
        return Result.success(res);
    }
}
